package com.grandprixsw.evmsmobile;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class TerminologyArrayAdapter extends ArrayAdapter<String> {
	private final Context context;
	private final String[] values;
	private final String[] terms;
 
	public TerminologyArrayAdapter(Context context, String[] abbreviations, String[] terms) {
		super(context, R.layout.definition_terminology_list_item, abbreviations);
		this.context = context;
		this.values = abbreviations;
		this.terms = terms;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
			.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
		View rowView = inflater.inflate(R.layout.definition_terminology_list_item, parent, false);
		TextView abbrView = (TextView) rowView.findViewById(R.id.abbreviation);
		TextView termsView = (TextView) rowView.findViewById(R.id.terms);
		abbrView.setText(values[position]);
		termsView.setText(terms[position]);
		
		return rowView;
	}
}
